const path = require('path');
module.exports = {
    reactScriptsVersion: "react-scripts",
    webpack: {
        alias: {
            "@": path.resolve(__dirname, 'src')
        }
    },
    style: {
        sass: {
            loaderOptions: {
                sourceMap: true,
                additionalData: `@import "@nutui/nutui-react/dist/styles/variables.scss";` /* Any sass-loader configuration options: https://github.com/webpack-contrib/sass-loader. */,
            },
        },
        postcss: {
            mode: 'extends',
            loaderOptions: {
                postcssOptions: {
                    ident: 'postcss',
                    plugins: [
                        [
                            'postcss-pxtorem',
                            {
                                rootValue: 375 / 10, // 根元素字体大小
                                propList: ['*']
                            },
                        ],
                    ],
                },
            },
        },
    },
    babel: {
        plugins: [
            [
                "import",
                {
                    libraryName: "@nutui/nutui-react",
                    libraryDirectory: "dist/esm",
                    style: true,
                    camel2DashComponentName: false,
                },
                "nutui-react",
            ],
        ],
    },
}